// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Json.InnerRetrieverConverter))]
public sealed partial class InnerRetriever
{
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public InnerRetriever(Elastic.Clients.Elasticsearch.ScoreNormalizer normalizer, Elastic.Clients.Elasticsearch.Retriever retriever, float weight)
	{
		Normalizer = normalizer;
		Retriever = retriever;
		Weight = weight;
	}
#if NET7_0_OR_GREATER
	public InnerRetriever()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	[System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")]
	public InnerRetriever()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal InnerRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	public
#if NET7_0_OR_GREATER
	required
#endif
	Elastic.Clients.Elasticsearch.ScoreNormalizer Normalizer { get; set; }
	public
#if NET7_0_OR_GREATER
	required
#endif
	Elastic.Clients.Elasticsearch.Retriever Retriever { get; set; }
	public
#if NET7_0_OR_GREATER
	required
#endif
	float Weight { get; set; }
}

public readonly partial struct InnerRetrieverDescriptor<TDocument>
{
	internal Elastic.Clients.Elasticsearch.InnerRetriever Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public InnerRetrieverDescriptor(Elastic.Clients.Elasticsearch.InnerRetriever instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public InnerRetrieverDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.InnerRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument>(Elastic.Clients.Elasticsearch.InnerRetriever instance) => new Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument>(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.InnerRetriever(Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument> descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument> Normalizer(Elastic.Clients.Elasticsearch.ScoreNormalizer value)
	{
		Instance.Normalizer = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument> Retriever(Elastic.Clients.Elasticsearch.Retriever value)
	{
		Instance.Retriever = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument> Retriever(System.Action<Elastic.Clients.Elasticsearch.RetrieverDescriptor<TDocument>> action)
	{
		Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor<TDocument>.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument> Weight(float value)
	{
		Instance.Weight = value;
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.InnerRetriever Build(System.Action<Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument>> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor<TDocument>(new Elastic.Clients.Elasticsearch.InnerRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}

public readonly partial struct InnerRetrieverDescriptor
{
	internal Elastic.Clients.Elasticsearch.InnerRetriever Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public InnerRetrieverDescriptor(Elastic.Clients.Elasticsearch.InnerRetriever instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public InnerRetrieverDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.InnerRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor(Elastic.Clients.Elasticsearch.InnerRetriever instance) => new Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.InnerRetriever(Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor Normalizer(Elastic.Clients.Elasticsearch.ScoreNormalizer value)
	{
		Instance.Normalizer = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor Retriever(Elastic.Clients.Elasticsearch.Retriever value)
	{
		Instance.Retriever = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor Retriever(System.Action<Elastic.Clients.Elasticsearch.RetrieverDescriptor> action)
	{
		Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor Retriever<T>(System.Action<Elastic.Clients.Elasticsearch.RetrieverDescriptor<T>> action)
	{
		Instance.Retriever = Elastic.Clients.Elasticsearch.RetrieverDescriptor<T>.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor Weight(float value)
	{
		Instance.Weight = value;
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.InnerRetriever Build(System.Action<Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.InnerRetrieverDescriptor(new Elastic.Clients.Elasticsearch.InnerRetriever(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}